# -*- coding: utf-8 -*-
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QSizePolicy, QLabel, QPushButton, QSpacerItem
from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QLineEdit
from PyQt5.QtCore import Qt,  QSize, QMetaObject, QCoreApplication


class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(300, 180)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        Form.setFixedSize(QSize(280, 160))
        Form.setWindowFlags(Qt.WindowCloseButtonHint)
        # 设置窗口无边框
        # Form.setWindowFlags(Qt.FramelessWindowHint)
        Form.setStyleSheet(
            # 设置整体窗口样式
            ".QWidget#Form{"
            "background-color: white;"
            "}"
            #设置输入框样式
            "QLineEdit{"
            "font: 10pt \"微软雅黑\";"
            "border-style: solid;"
            "border-width: 1px;"
            "border-color: #6B8E23;"
            "border-radius: 5px;"
            "background-color: rgb(127, 127, 127, 100)"
            "}"
            # 设置选择的按钮样式
            ".QPushButton#btn_1{"
            "border-image: url('./static/image/圆形1.svg');"
            "}"
            ".QPushButton#btn_2{"
            "border-image: url('./static/image/圆形2.svg');"
            "}"
            ".QPushButton#btn_3{"
            "border-image: url('./static/image/圆形3.svg');"
            "}"
            ".QPushButton#btn_4{"
            "border-image: url('./static/image/圆形4.svg');"
            "}"
            ".QPushButton#btn_5{"
            "border-image: url('./static/image/圆形5.svg');"
            "}"
            ".QPushButton#btn_6{"
            "border-image: url('./static/image/圆形6.svg');"
            "}"
            ".QPushButton#btn_7{"
            "border-image: url('./static/image/圆形7.svg');"
            "}"
            ".QPushButton#btn_8{"
            "border-image: url('./static/image/圆形8.svg');"
            "}"
            ".QPushButton#btn_9{"
            "border-image: url('./static/image/圆形9.svg');"
            "}"
            ".QPushButton#btn_10{"
            "border-image: url('./static/image/圆形10.svg');"
            "}"
            ".QPushButton#btn_11{"
            "background-color: rgb(127, 127, 127, 0);"
            "border: 0;"
            "font: \'微软雅黑\';"
            "}"
            # 设置确认、取消按钮样式，自定义颜色
            ".QPushButton#pushButton{"
            "background-color: #6B8E23;"
            "border-width: 0px;"
            "color: white;"
            "border-radius: 5px;"
            "}"
            ".QPushButton#pushButton_2{"
            "background-color: #6B8E23;"
            "border-width: 0px;"
            "color: white;"
            "border-radius: 5px;"
            "}"
            )

        # 标记新建的清单的颜色，默认为无颜色的图标名称
        self.Add_List_Color_Flag = "圆形11.svg"

        # 标记窗口打开作用的新建清单还是修改清单
        self.ifModify = False

        # 上半部分、下半部分组成的全局水平布局
        self.horizontalLayout_3 = QHBoxLayout(Form)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")

        # 上半部分、下半部分组成的垂直布局
        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setSpacing(10)
        self.verticalLayout.setObjectName("verticalLayout")

        # 清单名称输入框
        self.lineEdit = QLineEdit(Form)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth())
        self.lineEdit.setFixedHeight(25)
        self.lineEdit.setSizePolicy(sizePolicy)
        self.lineEdit.setObjectName("lineEdit")
        self.verticalLayout.addWidget(self.lineEdit)

        # 清单颜色标签、颜色标签、空格组成的水平布局
        self.horizontalLayout_1 = QHBoxLayout()
        self.horizontalLayout_1.setObjectName("horizontalLayout_1")
        self.horizontalLayout_1.setSpacing(5)

        # 清单颜色标签
        self.label = QLabel()
        font = QFont()
        font.setPointSize(10)
        font.setFamily("微软雅黑")
        self.label.setFont(font)
        self.label.setText("颜色：")
        self.label.setObjectName("lable")
        self.horizontalLayout_1.addWidget(self.label)

        # 颜色标签
        self.label_1 = QPushButton()
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_1.sizePolicy().hasHeightForWidth())
        self.label_1.setFixedSize(20, 20)
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形11.svg');")
        self.label_1.setObjectName("lable_1")
        self.horizontalLayout_1.addWidget(self.label_1)

        # 空格
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.horizontalLayout_1.addItem(spacerItem)
        self.verticalLayout.addLayout(self.horizontalLayout_1)

        # 颜色图标组成的水平布局
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setSpacing(4)
        self.horizontalLayout.setObjectName("horizontalLayout")

        # 各种颜色图标
        self.btn_1 = QPushButton()
        self.btn_2 = QPushButton()
        self.btn_3 = QPushButton()
        self.btn_4 = QPushButton()
        self.btn_5 = QPushButton()
        self.btn_6 = QPushButton()
        self.btn_7 = QPushButton()
        self.btn_8 = QPushButton()
        self.btn_9 = QPushButton()
        self.btn_10 = QPushButton()
        self.btn_11 = QPushButton()
        self.btn_11.setText("无")

        self.btn_1.setObjectName("btn_1")
        self.btn_2.setObjectName("btn_2")
        self.btn_3.setObjectName("btn_3")
        self.btn_4.setObjectName("btn_4")
        self.btn_5.setObjectName("btn_5")
        self.btn_6.setObjectName("btn_6")
        self.btn_7.setObjectName("btn_7")
        self.btn_8.setObjectName("btn_8")
        self.btn_9.setObjectName("btn_9")
        self.btn_10.setObjectName("btn_10")
        self.btn_11.setObjectName("btn_11")


        self.btn_1.setFixedSize(20, 20)
        self.btn_2.setFixedSize(20, 20)
        self.btn_3.setFixedSize(20, 20)
        self.btn_4.setFixedSize(20, 20)
        self.btn_5.setFixedSize(20, 20)
        self.btn_6.setFixedSize(20, 20)
        self.btn_7.setFixedSize(20, 20)
        self.btn_8.setFixedSize(20, 20)
        self.btn_9.setFixedSize(20, 20)
        self.btn_10.setFixedSize(20, 20)
        self.btn_11.setFixedSize(20, 20)

        # 各种颜色图标样式设置
        # 图标大小策略
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btn_1.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_2.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_3.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_4.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_5.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_6.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_7.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_8.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_9.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_10.sizePolicy().hasHeightForWidth())
        sizePolicy.setHeightForWidth(self.btn_11.sizePolicy().hasHeightForWidth())
        # 添加至水平布局
        self.horizontalLayout.addWidget(self.btn_1)
        self.horizontalLayout.addWidget(self.btn_2)
        self.horizontalLayout.addWidget(self.btn_3)
        self.horizontalLayout.addWidget(self.btn_4)
        self.horizontalLayout.addWidget(self.btn_5)
        self.horizontalLayout.addWidget(self.btn_6)
        self.horizontalLayout.addWidget(self.btn_7)
        self.horizontalLayout.addWidget(self.btn_8)
        self.horizontalLayout.addWidget(self.btn_9)
        self.horizontalLayout.addWidget(self.btn_10)
        self.horizontalLayout.addWidget(self.btn_11)
        self.verticalLayout.addLayout(self.horizontalLayout)

        # 空格
        spacerItem_1 = QSpacerItem(40, 20, QSizePolicy.Fixed, QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem_1)
        
        # 确认按钮、取消按钮组成的水平布局
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setSpacing(90)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        
        # 确认按钮
        self.pushButton = QPushButton(Form)
        self.pushButton.setFixedSize(80, 25)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout_2.addWidget(self.pushButton)
        
        # 取消按钮
        self.pushButton_2 = QPushButton(Form)
        self.pushButton_2.setFixedSize(80, 25)
        self.pushButton_2.setFont(font)
        self.pushButton_2.setObjectName("pushButton_2")
        self.horizontalLayout_2.addWidget(self.pushButton_2)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_3.addLayout(self.verticalLayout)

        # 信号动作集合
        self.btn_1.clicked.connect(self.circle_1)
        self.btn_2.clicked.connect(self.circle_2)
        self.btn_3.clicked.connect(self.circle_3)
        self.btn_4.clicked.connect(self.circle_4)
        self.btn_5.clicked.connect(self.circle_5)
        self.btn_6.clicked.connect(self.circle_6)
        self.btn_7.clicked.connect(self.circle_7)
        self.btn_8.clicked.connect(self.circle_8)
        self.btn_9.clicked.connect(self.circle_9)
        self.btn_10.clicked.connect(self.circle_10)
        self.btn_11.clicked.connect(self.circle_11)

        self.retranslateUi(Form)
        QMetaObject.connectSlotsByName(Form)

    """槽函数集合"""

    def circle_1(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形1.svg');")
        self.label_1.setObjectName("圆形1.svg")
        self.Add_List_Color_Flag = "圆形1.svg"

    def circle_2(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形2.svg');")
        self.label_1.setObjectName("圆形2.svg")
        self.Add_List_Color_Flag = "圆形2.svg"

    def circle_3(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形3.svg');")
        self.label_1.setObjectName("圆形3.svg")
        self.Add_List_Color_Flag = "圆形3.svg"

    def circle_4(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形4.svg');")
        self.label_1.setObjectName("圆形4.svg")
        self.Add_List_Color_Flag = "圆形4.svg"

    def circle_5(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形5.svg');")
        self.label_1.setObjectName("圆形5.svg")
        self.Add_List_Color_Flag = "圆形5.svg"

    def circle_6(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形6.svg');")
        self.label_1.setObjectName("圆形6.svg")
        self.Add_List_Color_Flag = "圆形6.svg"

    def circle_7(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形7.svg');")
        self.label_1.setObjectName("圆形7.svg")
        self.Add_List_Color_Flag = "圆形7.svg"

    def circle_8(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形8.svg');")
        self.label_1.setObjectName("圆形8.svg")
        self.Add_List_Color_Flag = "圆形8.svg"

    def circle_9(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形9.svg');")
        self.label_1.setObjectName("圆形9.svg")
        self.Add_List_Color_Flag = "圆形9.svg"

    def circle_10(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形10.svg');")
        self.label_1.setObjectName("圆形10.svg")
        self.Add_List_Color_Flag = "圆形10.svg"

    def circle_11(self):
        self.label_1.setStyleSheet("border-image: url('./static/image/圆形11.svg');")
        self.label_1.setObjectName("圆形11.svg")
        self.Add_List_Color_Flag = "圆形11.svg"

    def retranslateUi(self, Form):
        _translate = QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "添加清单"))
        self.pushButton.setText(_translate("Form", "确  认"))
        self.pushButton_2.setText(_translate("Form", "取  消"))

    def clasString(self):
        return "MyListWindow"
